/***********************************************************************
 * Dao Interface :  SysPermissionDao.java
 * Author:  Bill Vison
 * Purpose: Defines the Interface SysPermissionDao
 ***********************************************************************/
package org.vsg.security.model.persistence;

import java.io.Serializable;
import java.util.Collection;
import java.util.Set;

import org.springframework.dao.DataAccessException;
import org.vsg.common.pagination.Pagination;
import org.vsg.common.pagination.PaginationException;
import org.vsg.common.pagination.datatrans.PaginationProvider;
import org.vsg.security.model.domain.ResourceAssociation;
import org.vsg.security.model.domain.SysResource;
import org.vsg.security.model.domain.SysRole;


public interface ResourceAssociationDao {

	/**
	 * @param sysPermission
	 * @exception DataAccessException
	 */
	public void save(ResourceAssociation sysPermission) throws DataAccessException;


	/**
	 * 
	 * @param allSysPermission
	 * @throws DataAccessException
	 */
	public void saveAll(Collection<ResourceAssociation> allSysPermission) throws DataAccessException;


	/**
	 * @param sysPermission
	 * @exception DataAccessException
	 */   
	public void update(ResourceAssociation sysPermission) throws DataAccessException;
	
	/**
	 * @param pk -- primary key for loading entity
	 * @exception DataAccessException
	 */   
	public ResourceAssociation load(Serializable pk) throws DataAccessException;
	
	
	/**
	 * @param sysPermission
	 * @exception DataAccessException
	 */   
	public void delete(ResourceAssociation sysPermission) throws DataAccessException;

	/**
	 * 
	 * @param all
	 * @throws DataAccessException
	 */
	public void deleteAll(Collection<ResourceAssociation> all) throws DataAccessException;
	
   	/** 
   	 * @param provider
   	 * @exception DataAccessException
   	 * @exception PaginationException
   	 */
   	public Pagination pageSysPermission(PaginationProvider provider) throws DataAccessException, PaginationException;
   
   	/** 
   	 * @param provider
     * @exception DataAccessException
     * @exception PaginationException
     *
     */
   	public Pagination pageSysPermissionByAll(PaginationProvider provider) throws DataAccessException, PaginationException;
	
   	/**
   	 * 
   	 * @return
   	 * @throws DataAccessException
   	 */
	public Collection<ResourceAssociation> findByAll() throws DataAccessException;	
	

	/**
	 * 
	 * @param role
	 * @return
	 * @throws DataAccessException
	 */
	public Set<ResourceAssociation> findAssociationByRole(SysRole role) throws DataAccessException;

	/**
	 * 
	 * @param role
	 * @param resource
	 * @return
	 * @throws DataAccessException
	 */
	public Set<ResourceAssociation> findAssocation(SysRole role , SysResource resource) throws DataAccessException;
}	